home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Almathera Ten Pack 2: CDPD 1
/
Almathera Ten on Ten - Disc 2: CDPD 1.iso
/
pd
/
176-200
/
197
/
nro
/
nro.n
< prev
next >
Wrap
Text File
|
1995-03-13
|
29KB
|
713 lines
.tm Entering macro file
.so an
.tm Entering main file
.TH NRO 1 "AM*GA Programmer's Manual" "KosmoSoft" "Version 1.5"
.de cmd
!sp $1;!ne 2;!ti -5;!bo "$0
.en
.de fun
.sp $1;.ne 2;.ti -5;.bo "$0
.en
.SH NAME
nro - text formatter
.SH SYNOPSIS
.in +5;.ta +0;.ti -5
.bo "nro@t[-n] [+n] [-pxx] [-v] [-bx] [-rnx] [-rdx] [-rpx]
.bo "[-mmfile] ifile ... [>ofile]
.in -5;.ta
.SH DESCRIPTION
.ul "NRO
is a text processor and formatter based on the design
provided in
.bo ""Software Tools"
by Kernighan and Plauger. The text and commands found in the
.cu "ifile(s)
are processed to generate formatted text. The output may be directed into a
file or to the printer, otherwise, the output will appear at the user
console.
The
.ul "+n
option causes the output to start with page
.ul "n.
The
.ul "-n
option causes the output to stop after page
.ul "n.
The
.ul "-v
option prints the version number to the console. Specifying a higher
numerical argument makes
.bo "NRO
more and more verbose.
The
.ul "-p
option causes the output to be shifted to the right by
.ul "xx
spaces. This has the same effect as the
.bo "@.po
command.
The
.ul "-b
option with argument
.ul "x
controls if backspaces appear in the output text when underlining or
overstriking. This has the same effect as the
.bo "@.bs
command with the same argument.
The
.ul "-r
options allow you to specify how much memory is allocated for macro
definitions and related things. The
.ul "-rn
option lets you specify how many macros you may define while your text is
being formatted. Default is 512. The
.ul "-rd
option lets you specify how much memory is reserved for keeping the
contents of your macro definitions. Default is 20480 characters. The
.ul "-rp
option lets you specify how much characters may be pushed back into the
input, when processing a macro evaluation. Default is 1024 characters.
.br
If any of these options is present they must be located before the first
file to be processed to have any effect.
The
.ul "-m
option processes the file
.ul "mfile
for macro definitions. Note that files processed in this way should contain
only macro definitions, no immediate output should be generated from this
file.
.PP
Commands typically are distinguished by a period in column one of the input
followed by a two character abbreviation for the command funtion. The
abbreviation may then be followed by an optional numeric or character
argument.
.br
The numeric argument may be an absolute value such as setting the right
margin to a particular column, or the argument may be preceded by an
operator to indicate that the parameter should be modified relative to a
previous setting. You may use the operators +, -, /, *, % (mod), | (bitwise
or), & (bitwise and), = (equal), < (less than) and > (greater than) to
calculate values.
.ul "No
normal operator precedence is taken into account; the expression is
evaluated strictly from left to right. You may use parentheses to group
sub-expressions together. Note that all operators are dyadic, even the -.
To generate a negative value, use a form like 0-5. A leading operator in an
expression is not used in the evaluation. Instead, it has the effect of
altering a previously set value. The + operator increases the set value
with the given value, the - operator decreases the set value with the given
value, the * operator multiplies the set value with the given value, and
the / operator divides the set value by the given value. A leading operator
within parentheses is ignored.
.PP
Commands that have effect on a given number of input lines, can also take a
text argument, if it is preceded by a double quote character `"'. This
behaves exactly as if you gave the number 1, and followed the command with
the given text argument.
.br
More text or commands may follow a command if they are seperated by a
semicolon `;', unless the first command must be the last one on an input
line.
.tm ...commands
The following commands are recognized:
.in +5;.ta +0;.cc !
!*---------------------------*
!cmd .bo
@tcauses the following lines of text to appear in boldface. The optional
argument specifies the number of lines to be typed in boldface. An argument
of zero explicitly turns boldface off, while a negative argument turns it
on indefinitely. When overstrike is being used to produce the boldface,
boldface and underlining are mutually exclusive features, and the
appearance of a boldface command will cause any underlining to cease.
!*---------------------------*
!cmd .bp
@tcauses succeeding text to appear at the top of a new page. The optional
argument specifies the page number for the new page. The initial value is
one and the default value is one more than the previous page number.
!*---------------------------*
!cmd .br
@tcauses succeeding text to start on a new line at the current left margin.
There is no argument for this command.
!*---------------------------*
!cmd .bs
@tenables or disables the appearance of backspaces in the output text. A
value of
!cu "zero
doesn't use backspaces at all, but utilizes standard ISO printer codes.
The Commodore Amiga console and printer devices support these directly, but
on other systems you need a post-processor to convert these standard ISO
codes into, for example, Epson printer codes. If you don't want this,
underlining and boldface can be done by inserting character - backspace -
character combinations into the output. This is fine for devices which
properly recognize the backspace character. Many printers, however, do not
recognize backspaces, so the option is provided to overprint one line
buffer with another. The first line buffer is terminated with just a
carriage return rather than the carriage return - linefeed combination.
!br;An argument of
!cu "2
to the backspace command removes backspaces from the output. Even with
printers which do recognize backspaces, this usually is faster. An argument
of
!cu "1
puts them into the output. The default is to use Commodore Amiga (ISO)
control sequences.
!*---------------------------*
!cmd .cc
@tchanges the
!ul "NRO
command character to that specified by the character argument. If no
argument is provided, the default is a period.
!*---------------------------*
!cmd .ce
@tcauses the next line of text to appear centered on the output. This
automatically generates a break. The optional argument specifies if more
than one line is to be centered. An argument of zero explicitly turns
centering off, while a negative argument turns it on indefinitely.
!*---------------------------*
!cmd .cu
@tcauses the next line(s) of text to be continuously underlined. Unlike the
underline command (see
!bo ".ul)
which underlines only alphanumerics, continuous underlining underlines all
printable characters. The optional argument specifies the number of lines
of text to underlined. An argument of zero explicitly turns continuous
underline off, while a negative argument turns it on indefinitely. Any
normal underlining command currently in effect will be terminated.
!*---------------------------*
!cmd .de
@tcauses all text and commands following to be used to define a macro. The
definition is terminated by a line with
!bo ".en
as the first three characters. The rest of that line is ignored.
!br;The first argument following the
!bo ".de
command becomes the name of the new command.
!br;It should be noted that upper and lower case arguments are
considered different. Thus, the commands
!bo ".PP
and
!bo ".pp
could define two different macros. Care should be exercised since existing
commands and macros may be redefined. A macro may contain up to ten
arguments. In the macro definition, the placement of arguments is
designated by the two character sequences, $0, $1, ... $9.
!br
When the macro is invoked, each argument of the macro command line is
substituted for its corresponding designator in the expansion. The first
argument of the macro command is substituted for the $0 in the expansion,
the second argument for the $1, and so forth. Arguments are typically
strings which do not contain blanks or tabs. If an argument is to contain
blanks, then it should be surrounded by either single or double quotes.
!br
A macro name may be at most ten characters long. If more are supplied, the
results are unpredictable. To get things like $4 in the macro text, use a
double $$, i.e. $$4.
!*---------------------------*
!cmd .ef
@tspecifies the text for the footer on even numbered pages. The format is
the same as for the footer command (see
!bo ".fo).
!*---------------------------*
!cmd .eh
@tspecifies the text for the header on even numbered pages. The format is
the same as for the footer command (see
!bo ".fo).
!*---------------------------*
!cmd .el
@tSee
!bo ".if
and
!bo ".ie.
The
!bo ".el
command reverses the truth of the condition remembered by the last
!bo ".ie.
command, and if the result is true, it accepts the input on the remainder
of the line, just like the
!bo ".if
command. Multi-line else-parts are thus also possible. You may have
multiple
!bo ".el
request following a single
!bo ".ie
command. Since every
!bo ".el
reverses the remembered condition, you have if effect multiple 'then-' and
'else-parts', just divided into bits and pieces.
!*---------------------------*
!cmd .ev
@tenvironment switch. If a numerical argument is given, the number of the
current environment is pushed on a special environment number stack, and
the named environment is made current. If no argument is supplied, the
previous environment number that was in effect will be restored. As a
variation of this, the command
!bo ".ev -
will restore the previous environment and
!ul "discard
the current environment. This is useful if you don't need the particular
environment anymore. At a new invocation of this environment it will have
default values again.
!br
The environment is the set of values that determine the appearance of
formatted output. There are ten environments available, and up to nineteen
environment numbers can be pushed. Because a stack of previous environment
numbers is maintained, always return to a previous environment by a
!bo ".ev
command without numeric argument.
!br
The following commands affect values that are in the environment:
!bo 2
.ls .ti .in .rm .ce .ul .cu .it .ta .ju .nj .bo .fi .nf .pn .pc .cc and
!bo ".c2.
!br
Also in the environment are the last remembered conditional,
!bo ".ie,
and collected partial output lines.
!*---------------------------*
!cmd .en
@tdesignates the end of a macro definition.
!*---------------------------*
!cmd .fi
@tcauses the input text to be rearranged or filled to obtain the maximum
word count possible between the previously set left and right margins. No
argument is expected.
!*---------------------------*
!cmd .fo
@tspecifies text to be used for a footer. The footer text contains three
strings seperated by a delimiter character. The first non-blank character
following the command is designated as the delimiter. The first text string
is left justified to the current indentation value (specified by
!bo ".in).
The second string is centered between the current indentation value and the
current right margin value (specified by
!bo ".rm).
The third string is right justified to the current right margin value. The
absence of footer text will result in the footer being printed as one blank
line. The presence of the page number character (set by
!bo ".pc)
in the footer text results in the current page number being inserted at
that position. Multiple occurrances of the page number character are
allowed. This command must be the last command on an input line.
!*---------------------------*
!cmd .he
@tspecifies text to be used for a header. The for
mat is the same as for the
footer (see
!bo ".fo).
!*---------------------------*
!cmd .ie
@tSame as
!bo ".if,
but remembers the resulting condition, that can be used by subsequent
!bo ".el
requests. Only one level of conditions is remembered: they cannot be
nested. Every occurrence of a
!bo ".ie
request overrides the result as remembered by the previous one.
!*---------------------------*
!cmd .if
@tConditional acceptance of input. The request is followed by a
conditional, which may take several forms. Depending on the condition,
subsequent input may be accepted or ignored. The following forms of
condition are valid:
!in +9;!ti -4;!nj
!bo ".if [!]<letter>
anything
!ti -4;!bo ".if [!]<expression>
anything
!ti -4;!bo ".if [!]<delimiter> <string1> <delimiter> <string2> <delimiter>
anything
!in -9;!ju
The following <letter>s may be used:
!bo "o:
Current page number is odd;
!bo "e:
Current page number is even;
!bo "n:
Formatter is
!ul "NRO,
which is always true;
!bo "t:
Formatter is TRO(FF), which is always false.
!br
An <expression> is said to be true if it is > 0.
!br
The last form is a string comparison, which is true if <string1> and
<string2> are exactly equal. Any <delimiter> may be used as long as it
doesn't make the conditional look like one of the other forms.
!br
A not-symbol `!' may immediately precede the condition to reverse its
truth.
!br
Normally, the accepted or ignored input affected is only the rest of the
current input line. A multi-line `then-part' must begin with the opening
delimiter @@{ and the last line must end with the closing delimiter @@}. It
may also be useful to conceal the newline following the opening delimiter
if it is at the end of an input line. Because the delimiters are deleted
from the input, make sure that the line is not empty without them, because
this would cause a break. It is sufficient to place them on a line with a
comment command to avoid this.
!*---------------------------*
!cmd .in
@tindents the left margin to the column value specified by the argument.
The default left margin is set to zero. This command performs a break.
!*---------------------------*
!cmd .it
@tcauses the following lines of text to appear in italics. The optional
argument specifies the number of lines to be typed in italics. An argument
of zero explicitly turns italics off, while a negative argument turns it on
indefinitely. This command is
!bo "not
functional when the Commodore Amiga (ISO) command sequences are not being
used, since it can't be emulated by overstriking printlines.
!*---------------------------*
!cmd .ju
@tcauses blanks to be inserted between words in a line of output in order
to align or justify the right margin. The default is to justify. No
argument is expected.
!*---------------------------*
!cmd .ls
@tsets the line spacing to the value specified by the argument. The default
is for single spacing.
!*---------------------------*
!cmd .m1
@tspecifies the number of lines in the header margin. This is the space
from the physical top of page to and including the header text. A value of
zero causes the header to not be printed. A value of one causes the header
to appear at the physical top of page. Larger argument values cause the
appropriate number of blank lines to appear before the header is printed.
!*---------------------------*
!cmd .m2
@tspecifies the number of blank lines to be printed between the header line
and the first line of the processed text.
!*---------------------------*
!cmd .m3
@tspecifies the number of blank lines to be printed between the last line
of processed text and the footer line.
!*---------------------------*
!cmd .m4
@tspecifies the number of lines in the footer margin. This command affects
the footer the same way the
!bo ".m1
command affects the header.
!*---------------------------*
!cmd .ne
@tspecifies a number of lines which should not be broken across a page
boundary. If the number of lines remaining on a page is less than the value
needed, then a new output page is started.
!*---------------------------*
!cmd .nf
@tspecifies that succeeding text should be printed without rearrangement,
or with no fill. The default is to justify. No argument is expected.
!*---------------------------*
!cmd .nj
@tspecifies that no attempt should be made to align or justify the right
margin. No argument is expected.
!*---------------------------*
!cmd .nr
@tcauses the value of a number register to be set or modified. A total of
twenty-six number registers are available designated @@na through @@nz
(either upper or lower case is allowed). When the sequence @@nc is imbedded
in the text, the current value of number register c replaces the sequence,
thus, such things as paragraph numbering can be accomplished with relative
ease.
!*---------------------------*
!cmd .of
@tspecifies the text for the footer on odd numbered pages. The format is
the same as the footer command (see
!bo ".fo).
!*---------------------------*
!cmd .oh
@tspecifies the text for the header on odd numbered pages. The format is
the same as the footer command (see
!bo ".fo).
!*---------------------------*
!cmd .pc
@tspecifies the page number character to be used in headers and footers.
The occurrance of this character in the header or footer text results in
the current page number being printed. The default for this character is
the hash mark `#'.
!*---------------------------*
!cmd .pl
@tspecifies the page lenght or the number of lines per output page. The
default is 66.
!*---------------------------*
!cmd .pn
@tspecifies the way page numbering is done. You may specify the following
values: 0 uses normal arabic page numbers, 1 generates lowercase roman
numbers, and 2 specifies uppercase roman numbers. Default is arabic page
numbering.
!*---------------------------*
!cmd .po
@tspecifies a page offset value. This allows the formatted text to be
shifted to the right by the number of spaces specified. This feature may
also be invoked by a switch on the command line. All horizontal positions
(like tabstops, indentations) are adjusted accordingly.
!*---------------------------*
!cmd .rm
@tsets the column value for the right margin. The default is 80.
!*---------------------------*
!cmd .so
@tcauses input to be retrieved from the file specified by the command's
character string argument. The contents of the new file are inserted into
the output stream until an EOF is detected. Processing of the original file
is then resumed. File nesting is allowed up to a reasonable level (four).
!*---------------------------*
!cmd .sp
@tspecifies a number of blank lines to be output before printing the next
line of text. This automatically generates a break. You cannot move
upwards.
!*---------------------------*
!cmd .ta
@ttab settings. This command allows you to set tabstops. It may have
optional numeric arguments. When issued without arguments, all tabstops are
removed. When issued with one or more numeric arguments, tabstops are set
at the specified number of spaces from the left hand side of the paper. An
argument may optionally be preceded with a `+' to indicate that a distance
from the previously mentioned tab is meant instead of an absolute position.
A `+' sign before the first argument indicates a distance from the current
indent.
!*---------------------------*
!cmd .ti
@ttemporarily alters the indentation or left margin value for a single
succeeding line of output text. This command performs a break. If an input
line starts with spaces, this has the effect that a break is generated, and
a temporary indent for the number of spaces is set.
!*---------------------------*
!cmd .tm
@twrites a message to the standard error output, so you see it in your
console window. This command must be the last one on an input line. When
used with the no-break command character, this `no-break' gets another
meaning: don't break the formatted output if it also is printed on the
console. The command is ignored instead.
!*---------------------------*
!cmd .ul
@tunderlines the alphanumeric text in the following line(s). The optional
argument specifies the number of lines to be underlined. An argument of
zero explicitly turns underlining off, while a negative argument turns it
on indefinitely. When overstrike is being used to produce the underline,
underlining and boldface are mutually exclusive features, and the
appearance of an underline command cancels any existing boldface
operations.
!*---------------------------*
!cmd .un
@tundefines a previously defined macro, and all macros that were defined
later. If this macro was a redefinition of an older macro with the same
name, the old definition will be available again. Thus, macros are defined
in a stack-like fashion.
!cmd .*
!cmd ." 0
@tBoth of these serve as a way to insert comments in the input text. They
have absolutely no effect on the output.
!*---------------------------*
!cc
.in -5;.PP
.tm End of commands
Instead of having the command immediately at the beginning of a line, you
may also begin a line with a command character, then some blanks, and then
again a command character, this time followed immediately by the command.
There exists even a second command character, called the
.bo "no break command character,
`'', which suppresses the break normally generated by some commands. This
no break command character can only be used in this way. If the first
non-blank character is
.ul "not
a command character, it is considered to be text. An example illustrates
this.
.RS 5;.nf
@. .sp @@" This is a space command,
@. this is some normal text,
@. 'sp 3 @@" and this spaces without a break.
.RE;.fi
.PP
When a line does not begin with the command character, its words are placed
one by one on an output line. As soon as a word doesn't fit, the collected
line is printed, possibly after justification. The word is then placed on
the next output line. If a line is about to be printed at the top of a
page, the page header, if any, is printed first. If a line is on the last
usable line of a page, the page footer, if any, is printed next, and the
page is ejected.
.br
If you want to begin an input text line with an instance of the command
character, you may precede it with the escape character.
.PP
A number of translations can be performed on the input, even before it is
interpreted as either text or commands. Such a translation takes place
where an escape character `@@' is seen in the input text. The single
charachter following the escape character determines the effect.
.tm ...functions
The following functions are currently implemented:
.in +5
.fun @@@@
@tis a single @@.
.*---------------------------*
.fun @@e
@tis replaced by the current value of the escape character. Currently,
there is no way to change it.
.*---------------------------*
.fun @@n
@tfollowed by a single letter, is replaced by the contents of the
designated number register.
.*---------------------------*
.fun @@t
@tis replaced with a tab character, to be used in conjunction with the
.bo "@.ta
command. You may also use a normal tab character if you wish. If a tab is
encountered, the necessary space is generated by non-breakable spaces. Any
spaces on the output line before the tab are also made non-breakable. This
is to avoid justification spoiling the tab.
.br
Tabs beyond the current right margin or beyond the last tab stop are
ignored, except that they separate words.
.*---------------------------*
.fun @@X(expression)
@tis replaced with the character with character code value `expression'.
.*---------------------------*
.fun @@(space)
@tis replaced by a non-breakable space. It behaves just like any printable
character, you just don't see it. This space won't be modified by
justification, and it will be underlined by continous underline.
.*---------------------------*
.fun @@(newline)
@tis deleted from the input. If a @@ is placed at the end of an input line,
it will appear as if the next input line actually is following the contents
of the current line. This is called `concealing the newline'.
.*---------------------------*
.fun @@.
@twhere . stands for the current command character, produces the command
character. It will, however, not be recognized as such. This provides a way
to start your input line with a command character that in fact is a text
line. This only works if the command character is different from any other
valid character following the escape character, and does not work for
.bo "@.en
commands that end a macro definition.
.*---------------------------*
.fun @@{
.fun @@} 0
@tThese two delimiters were already mentioned in the section about the
.bo "@.if
and
.bo "@.el
commands. They serve to delimit the lines you want to be affected by these
commands. Normally, when the condition is false, the
.bo "@.if
skips input until it finds the end of the current line. If it sees the @@{
following the condition, it sets a flag to indicate to the low-level file
reader, that it must count these delimiters. All input is then skipped
until the matching closing delimiter @@} is found. So, the
.bo "@.if
command never 'sees' anything of it. Also in this case, the
.bo "@.if
command skips the rest of the line remaining after the closing @@}.
.br
On the other hand, if the condition evaluates to be true, all and any
opening and closing delimiters are ignored completely. The command
following the condition is executed, and also of course any commands on
following lines. Since a command (or text) is expected on the same line as
the
.bo "@.if
command, omission of a command makes it look like there is an empty line,
and this generates an unexpected break. Therefore, you should conceal the
newline at the end of such a line. (See @@(newline).)
.*---------------------------*
.fun @@"
@tThis is yet another way to insert a comment. Note that text may precede
the comment function. All text from the comment function until the end of
the line will be ignored. Note that spaces between the last word on a line
and the comment are not deleted, and this may effect your layout in some
(as of yet unimplemented) cirumstances.
.in -5
Any unrecognized character that follows the @@ will be left in the input.
.PP
Macro expansion is accomplished in the following way. There exists an input
push-back buffer. If any input is needed, this push-back buffer is examined
first. If a character is present, the request is satisfied by taking the
last pushed back character. Only if the push back buffer is empty, a
character is read from the input file. At any time that
.ul "NRO
reads a character that is unexpected, it is pushed back, in the hope that
it can be used later.
.br
When a macro is to be expanded, its body is pushed back, while at the same
time subsituting the arguments. Normally when an instance of the escape
character is to be pushed back, it is `guarded' against re-substitution
when it is read back, by doubling it, so anything pushed back will be read
back exactly the same. This is not done
.ul "only
for macro bodies, to allow resubstitution to occur in them. This means that
the body of a macro is interpreted twice, once at definition time, and once
at application time. The macro arguments are interpreted only once, so that
a double escape character in an argument will show up in the resulting text
as a single escape character, instead of disappearing. This seems to be the
most intuitive approach. It will disallow some more complex applications
but avoids needing four @@'s in an argument if you want only one.
.tm ...examples
.SH EXAMPLES
.SS "Macros:
You may even define a macro that defines a macro, in the following way:
.br;.RS +5;.nf
@.de keep
@.de $0
$1 $2 $3 $4 $5 $6 $7 $8 $9
@@@@.en
@.en
.fi;.RE
This macro defines a macro with a name designated by the first argument,
and containing the text designated by the remaining arguments. Remember
that you can always enclose an argument with quotes.
.br
Note that you must use two escape characters to make the
.bo "@.en
part of the macro body. This is because macro definitions are handled
slightly different from normal input lines. In the definition of `keep'
there will be a line with
.bo "@@.en,
and at the time of definition of the inner macro the second escape
character will be stripped off, so that the end of the inner macro
definition is recognized.
.br
Another way to to it, is to change the command character temporarily while
defining the outer macro.
.SS "Conditionals:
Here are a few examples of correct use of the
.bo "@.if, .ie
and
.bo "@.el
commands:
.br;.RS +5;.nf
@.if @@na Register A is greater than zero!
@.if @@na @@{.firstcommand
@. .secondcommand
@. .lastcommand @@}
@.if @@na @@{@@
@. .firstcommand
@. .secondcommand
@. .lastcommand @@}
@.ie @@na @@{.firstcommand
@. .secondcommand
@. .lastcommand @@}
@.el Register A is NOT greater than zero!!
@.el Maybe a bit late, but register A IS greater than zero!!
.fi;.RE
.tm ...undocumented features
.SH "UNDOCUMENTED FEATURES"
.PP
<censored>